import Vue from 'vue'
import Vuex from 'vuex'
import {setLocal, getLocal} from '@/utils/storage'

Vue.use(Vuex)

export default new Vuex.Store({
  // 状态 数据
  state: {
    user: getLocal('user')
  },
  // 操作数据
  mutations: {
    setToken(state, user) {
      state.user = user

      setLocal('user', user)
    }
  }
})
